﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Framework
{
    public class Program
    {
        static void Main(string[] args)
        {
            ConstructDb();
            //SqlDbContext context = new SqlDbContext();
            //User user1 = new User
            //{
            //    Name = "小金",
            //    Password = "123",
            //    CreateTime = new DateTime(2020, 1, 8)
            //};

            //User user2 = new User
            //{
            //    Name = "小银",
            //    Password = "234",
            //    CreateTime = new DateTime(2020, 2, 15)
            //};

            //User user3 = new User
            //{
            //    Name = "小铜",
            //    Password = "345",
            //    CreateTime = new DateTime(2020, 3, 27)
            //};
            //context.Users.Add(user1);
            //context.Users.Add(user2);
            //context.Users.Add(user3);


            //context.Users.Find(1);

            //User user4 = new User { Id = 1 };
            //context.Users.Attach(user4);
            //user4.Name = "小邋遢";

            //context.Users.Remove(user4);

            //context.SaveChanges();

        }
        static void ConstructDb()
        {
            SqlDbContext context = new SqlDbContext();
            context.Database.Delete();
            context.Database.Create();
        }
    }
    
}
